#ifndef KMY_SCENE_MANAGER_H
#define KMY_SCENE_MANAGER_H

#include "KmyTypedef.h"
#include "KmyIScene.h"
#include "ITimer.h"
#include "KmyConfigList.h"
#include "KmyIControllerPad.h"

/**
  * 原ScreenMananger
  * 用来管理各种Scene
  * 每次只能存在一个Scene
  */

class KmySceneManager
{
public:
    KmySceneManager();
    virtual ~KmySceneManager();

    static const u8 SCENE_TYPE_NULL     = 0;
    /**
    static const u8 SCENE_TYPE_LOGO     = 1;
    static const u8 SCENE_TYPE_TITLE    = 2;
    static const u8 SCENE_TYPE_SELECT   = 3;
    static const u8 SCENE_TYPE_GAME     = 4;
    static const u8 SCENE_TYPE_HELP     = 5;
    */

    u8 cur_scene_type;
    u8 next_scene_type;

    KmyIScene *cur_scene;
//    KmySceneInterface *next_Scene;

//    KmyICanvas* main_screen;
//    KmyICanvas* sub_screen;
    int screen_count;
    KmyICanvas** screens;
    KmyConfigList* config_list;

    KmyIControllerPad* controller_pad;

    void run();
    virtual KmyIScene* createScene(u8 scene_type) = 0;
    void changeScene(u8 scene_type);
    KmyIScene* getCurScene();

    void logic();
    void render();
    void exit();

    /** 获取引擎运行时间，单位毫秒 */
    int getEnginePassTime();

    KmyIControllerPad* getControllerPad();
    ITimer* getTimer();

protected:
    bool is_exit;
    ITimer *timer;
    int last_time;
    int interval;

};

#endif // KMY_SCENE_MANAGER_H
